package zelix.hack.hacks;

import zelix.hack.Hack;
import zelix.hack.HackCategory;
import zelix.value.NumberValue;
import net.minecraft.block.BlockAir;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
import zelix.managers.HackManager;
import zelix.utils.TimerUtils;
import zelix.utils.Utils;
import zelix.utils.Wrapper;

public class Fall extends Hack {
	Hack h = HackManager.getHack("Blink");
	TimerUtils timer = new TimerUtils();
	NumberValue height;
	public Fall() {
		super("AntiFall", HackCategory.PLAYER);
		this.height=new NumberValue("Height", 2d, 1d, 10d);
		this.addValue(height);
	}
	
	@Override
	public void onClientTick(ClientTickEvent event) {
		super.onClientTick(event);
	}

	@Override
	public void onDisable() {
		h.onDisable();
		h.setToggled(false);
		super.onDisable();
	}
	@Override
	public void onEnable() {
		Utils.nullCheck();
		h.onEnable();
		h.setToggled(true);
		Jump();

		// this.setToggled(false);
		super.onEnable();
	}
	private Boolean isBlockBelow() {
		for(int i = (int) (Wrapper.INSTANCE.player().posY-1.0); i>0; --i) {
			final BlockPos pos=new BlockPos(Wrapper.INSTANCE.player().posX, i, Wrapper.INSTANCE.player().posZ);
			if(!(Wrapper.INSTANCE.world().getBlockState(pos).getBlock() instanceof BlockAir)) {
				return true;
			}
		}
		return false;
		
	}
	
	void Jump() {
		Utils.nullCheck();
		Wrapper.INSTANCE.player().motionY=height.getValue();
	}
}
